﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Employee_HRApplicantInformation : System.Web.UI.Page
{
    string ID = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            ID = Request.QueryString["ID"].ToString();
            LoadData();
        }
        catch (Exception ex)
        {
        }
    }
    private void LoadData()
    {
        EmployeeMethord EM = new EmployeeMethord();
        DataTable tb = EM.ReturnApplicantIDInformationWithID(ID);
        if (tb.Rows.Count > 0)
        {
            txtTitleVacancy.Text = "<a href=\"HRViewVacancyDetails.aspx?ID=" + tb.Rows[0]["VacancyID"].ToString() + "\">" + EM.ReturnTitleVacancyWithID(tb.Rows[0]["VacancyID"].ToString()) + "</a>";
            txtApplicantID.Text = tb.Rows[0]["ApplicantID"].ToString();
            txtFullName.Text = tb.Rows[0]["FullName"].ToString();
            txtAddress.Text = tb.Rows[0]["Address"].ToString();
            txtPhone.Text = tb.Rows[0]["Phone"].ToString();
            txtBirthOfDate.Text = tb.Rows[0]["BirthOfDate"].ToString().Substring(0, tb.Rows[0]["BirthOfDate"].ToString().IndexOf(" "));
            txtEmailID.Text = tb.Rows[0]["EmailID"].ToString();
            txtEducation.Text = tb.Rows[0]["Education"].ToString();
            txtLanguages.Text = tb.Rows[0]["ForeignLanguages"].ToString();
            txtWorkExperience.Text = tb.Rows[0]["WorkExperience"].ToString();
            switch(Convert.ToInt32(tb.Rows[0]["Status"].ToString()))
            {
                case 1:
                    txtStatus.Text = "<a href=\"ChangeStatusApplicant.aspx?ID="+txtApplicantID.Text+"\">Hired</a>";
                    break;
                case 2:
                    txtStatus.Text = "<a href=\"ChangeStatusApplicant.aspx?ID=" + txtApplicantID.Text + "\">Interview</a>";
                    break;
                case 3:
                    txtStatus.Text = "<a href=\"ChangeStatusApplicant.aspx?ID=" + txtApplicantID.Text + "\">In Process</a>";
                    break;
                case 4:
                    txtStatus.Text = "<a href=\"ChangeStatusApplicant.aspx?ID=" + txtApplicantID.Text + "\">Not In Process</a>";
                    break;
                case 5:
                    txtStatus.Text = "<a href=\"ChangeStatusApplicant.aspx?ID=" + txtApplicantID.Text + "\">Not apply to Vacancy</a>";
                    break;
            }
            lbtnChangeStt.PostBackUrl = "ChangeStatusApplicant.aspx?ID="+txtApplicantID.Text;
        }
    }
}